package com.hdy.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {

    //id对应数据库中的主键(uuid、自增id、雪花算法、redis、zookeeper!等都可以生成一个全局唯一id)
    /**
     *     AUTO(0),   主键自增
     *     NONE(1),     未设置主键
     *     INPUT(2),    手动输入
     *     ID_WORKER(3),    默认 ID_WORKER 全局唯一id
     *     UUID(4),         全局唯一id UUID
     *     ID_WORKER_STR(5);    ID_WORKER 字符串表示法
     */
    @TableId(type = IdType.AUTO)
    private long id;
    private String name;
    private Integer age;
    private String email;

    //字段添加填充内容
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Version    //乐观锁 version 的注解
    private Integer version;

    @TableLogic     //逻辑删除
    private Integer deleted;

}
